package com.wcn;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.*;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MapT {
    @Test
    public void mapT() {
        List<Map<String, String>> ml = new ArrayList<>();
        Map<String, String> m = new HashMap<>();
        m.put("1", "w");
        m.put("2", "c");
        m.put("3", "n");
        ml.add(m);
        Map<String, String> m1 = new HashMap<>();
        m1.put("1", "w");
        m1.put("2", "c");
        m1.put("3", "n");
        Map<String, String> m2 = new HashMap<>();
        m2.put("1", "w");
        m2.put("2", "c");
        m2.put("3", "n");
        ml.add(m);
        ml.add(m1);
        ml.add(m2);

        for (Map<String, String> mm : ml) {
            for (String mmm : mm.keySet()) {
                System.out.println(mmm + "----------" + mm.get(mmm));
            }
        }

        System.out.println("---------------------------------");
        Map<String, List<String>> lm = new HashMap<>();
        List<String> l = new ArrayList<>();
        List<String> l1 = new ArrayList<>();
        List<String> l2 = new ArrayList<>();
        l.add("1");
        l1.add("2");
        l2.add("3");

        lm.put("1", l);
        lm.put("2", l1);
        lm.put("3", l2);

        for (String ll : lm.keySet()) {
            System.out.println(ll+"------"+lm.get(ll));
            Iterator it=lm.get(ll).iterator();
            if(it.hasNext()){
                System.out.println(it.next());
            }
        }
    }

}
